from django.contrib import admin
from django.urls import path, re_path

from demo import views
from demo.views import AddArticleView, ArticleDetailView, ArticleUserView, ArticleUpdateView, ArticleDelete

urlpatterns = [
    # <str:info> <转换器的类型：参数名> 参数名接受路由传过来的数值
    # path("test/<str:info>",views.test),
    path("test/<int:info>", views.test),
    # path("tele/",views.tv)

    # 正则：
    # ?P 是规定参数的，固定的语法格式
    # <参数名>
    # ^ 限制以什么字符开头  $ 限制以什么字符结束
    # () 把符合规则的字符保留下来传给info参数接受
    # [] 限制路由参数字符串只能有数字和abc字母组成
    # + 字符个数的限制 1个及以上
    re_path("^re_tele/(?P<info>[0-9abc]+)/$", views.tv),
    path("nav/<str:classes>", views.nav),  # 把从网页获取到的字符串传给classes变量
    path("404/", views.not_find, name="not_find"),
    path("index/", views.index, name="index"),
    path("classes/", views.classes),
    path("tab_info/", views.tab_info),
    path("article/add/", AddArticleView.as_view(), name="AddArticle"),
    path("article/<int:id>/", ArticleDetailView.as_view(), name="ArticleDetail"),
    path("article/user/", ArticleUserView.as_view(), name="ArticleUser"),
    path("article/update/<int:id>/", ArticleUpdateView.as_view(), name="ArticleUpdate"),
    path("article/delete/<int:id>/", ArticleDelete.as_view(), name="ArticleDelete"),
]

















